﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.Imaging;
using System.Runtime.Serialization;
using Microsoft.Practices.Prism.ViewModel;

namespace Payton.WP7.Common.Model
{
    public class SNSAccount : NotificationObject
    {
        public SNSAccount(SNSProviderType svcProvider, int accountNum)
        {
            _svcProvider = svcProvider;
            _accountID = accountNum;
            AccountStatus = SNSAccountStatus.UnAuthorized;
        }

        public SNSAccount()
        {
            _svcProvider = SNSProviderType.Unknow;
        }

        bool isDestination = true;

        public bool IsDestination
        {
            get { return isDestination; }
            set
            {
                isDestination = value;
                RaisePropertyChanged(() => IsDestination);
            }
        }

        int _accountID;
        public int AccountID
        {
            get { return _accountID; }
            set { _accountID = value; }
        }


        SNSProviderType _svcProvider;
        public SNSProviderType ServiceProvider
        {
            get { return _svcProvider; }
            set { _svcProvider = value; }
        }

        public bool IsAuthorized
        {
            get { return (SNSAccountStatus.Authorized & AccountStatus) == SNSAccountStatus.Authorized; }
        }

        bool isBind;

        public bool IsBind
        {
            get { return isBind; }
            set
            {
                isBind = value;
                RaisePropertyChanged(() => IsBind);
            }
        }


        public SNSAccountStatus AccountStatus
        {
            get;
            set;
        }

        private string _authorizeURL;
        public string AuthorizeURL
        {
            get { return _authorizeURL; }
            set { _authorizeURL = value; }
        }

        private string _pin;
        public string PIN
        {
            get { return _pin; }
            set
            {
                if (_pin != value)
                    _pin = value;
            }
        }

        private string _oAuthToken;

        public string OAuthToken
        {
            get { return _oAuthToken; }
            set { _oAuthToken = value; }
        }

        private string _oAuthTokenSecret;

        public string OAuthTokenSecret
        {
            get { return _oAuthTokenSecret; }
            set { _oAuthTokenSecret = value; }
        }

        private string _accessToken;

        public string AccessToken
        {
            get { return _accessToken; }
            set { _accessToken = value; }
        }

        private string _accessTokenSecret;

        public string AccessTokenSecret
        {
            get { return _accessTokenSecret; }
            set { _accessTokenSecret = value; }
        }

        private string displayName;

        public string DisplayName
        {
            get { return displayName; }
            set { displayName = value; }
        }

        private string avtarUri;

        public string AvtarUri
        {
            get { return avtarUri; }
            set { avtarUri = value; }
        }

        private string userName;

        public string UserName
        {
            get { return userName; }
            set { userName = value; }
        }

        private string password;

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        private string refreshToken;

        public string RefreshToken
        {
            get { return refreshToken; }
            set { refreshToken = value; }
        }

        private int expiresIn;

        public int ExpiresIn
        {
            get { return expiresIn; }
            set { expiresIn = value; }
        }

        string scope;

        public string Scope
        {
            get { return scope; }
            set { scope = value; }
        }

        //private BitmapImage faceImage;

        //public BitmapImage FaceImage
        //{
        //    get { return faceImage; }
        //    set { faceImage = value; }
        //}

        SNSUser userLite;

        public SNSUser UserLite
        {
            get { return userLite; }
            set
            {
                userLite = value;
                RaisePropertyChanged(() => UserLite);
            }
        }

        bool isActive = true;

        public bool IsActive
        {
            get { return isActive; }
            set
            {
                isActive = value;
                RaisePropertyChanged(() => IsActive);
            }
        }

        bool isDelete;

        public bool IsDelete
        {
            get { return isDelete; }
            set
            {
                isDelete = value;
                RaisePropertyChanged(() => IsDelete);
            }
        }
        bool isDuplicate =false;

        public bool IsDuplicate
        {
            get { return isDuplicate; }
            set
            {
                isDuplicate = value;
                RaisePropertyChanged(() => IsDuplicate);
            }
        }

    }
}
